// eslint.config.mjs
import antfu from '@antfu/eslint-config'
import { FlatCompat } from '@eslint/eslintrc'

const compat = new FlatCompat()

export default antfu(
  {
    unocss: true,
    // 开始代码样式格式化
    stylistic: true,
    rules: {
      'no-console': 'off',
      'vue/valid-v-for': 'off',

      'no-use-before-define': 'off', // 允许使用未定义的变量
      '@typescript-eslint/no-use-before-define': 'off', // 允许使用未定义的变量
      '@typescript-eslint/no-unused-vars': 'off',
      'no-undef': 'off', // 允许使用未定义的变量
      'no-unused-vars': 'off', // 允许定义未使用的变量
      'eqeqeq': 'off',
      'unused-imports/no-unused-vars': 'off',
    },
    ignores: ['**/dist/**', 'vite.config.ts'],
    formatters: {
      css: true,
      html: true,
      markdown: true,
    },
    globals: {
      uni: true,
      wx: true,
      plus: true,
      uniCloud: true,
      getCurrentPages: true,
      getApp: true,
      UniApp: true,
    },
    ...compat.config({
      globals: {
        uniCloud: 'readonly',
        uni: 'readonly',
        plus: 'readonly',
        wx: 'readonly',
      },
    }),

  },
)
